package com.xkdx.caipiao.presistence.quert;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xkdx.caipiao.module.network.AbsModule;

public class IssueQueryModule extends AbsModule {
	public IssueQueryInfo info;
	public boolean isSuccess=false;
	@Override
	public void parseData() throws Exception {
		try {
			backJson = (JSONArray) result;
			for (int i = 0; i < backJson.size(); i++) {
				jsonObj = (JSONObject) backJson.get(i);
				String sortOfAct = jsonObj.getString("Act");
				if (sortOfAct.equals("IssueQuery")) {
					parseIssueQueryInfo(jsonObj.getJSONObject("DetailInfo"));
				}

			}
		} catch (Exception e) {
			// to do define a exception include all parseException
			throw e;
		}

	}

	private void parseIssueQueryInfo(JSONObject person)
			throws Exception {
		try {
			info=new IssueQueryInfo();
			info.setCtime(person.getString(IssueQueryInfo.CTIME));
			info.setCuser(person.getString(IssueQueryInfo.CUSER));
			info.setDesc(person.getString(IssueQueryInfo.DESC));
			info.setEndtime(person.getString(IssueQueryInfo.ENDTIME));
			info.setEtime(person.getString(IssueQueryInfo.ETIME));
			info.setEuser(person.getString(IssueQueryInfo.EUSER));
			info.setId(person.getString(IssueQueryInfo.ID));
			info.setIsnow(person.getString(IssueQueryInfo.ISNOW));
			info.setIssueid(person.getString(IssueQueryInfo.ISSUEID));
			info.setLotteryid(person.getString(IssueQueryInfo.LOTTERYID));
			info.setOpenawardtime(person.getString(IssueQueryInfo.OPENAWARDTIME));
			info.setOpennum(person.getString(IssueQueryInfo.OPENNUM));
			info.setReason(person.getString(IssueQueryInfo.REASON));
			info.setStarttime(person.getString(IssueQueryInfo.STARTTIME));
			info.setStatus(person.getString(IssueQueryInfo.STATUS));
			isSuccess=true;
		} catch (Exception e) {
			throw e;
		}
	}

}
